<?php
require_once("../system/funciones_bd.php");
require_once("../system/sesion.class.php");
//Conexion base de datos local
$link = mysql_connect("localhost", "root", "");
$sesion = new sesion();
$usuario = $sesion->get("usuario");
if ($usuario == false) {
    header("Location: ../index.php");
} else {

    $idPaciente = $_GET['idusuario'];
    mysql_set_charset('utf8', $link);
    ?>
    <!DOCTYPE html>
    <html lang="de"><!-- use class="debug" here if you develope a template and want to check-->
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
            <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0" />
            <!-- some meta tags, important for SEO"--> 
            <meta name="description" content="put a short description in here" />
            <meta name="keywords" content="put your important keywords in here" />
            <meta name="revisit-after" content="7 days" />
            <meta name="robots" content="index,follow" />

            <title>ForensicTooth v1.0</title>

            <link rel="stylesheet" href="../css/inuit_1.css" />
            <link rel="stylesheet" href="../css/fluid-grid16-1100px.css" />
            <link rel="stylesheet" href="../css/eve-styles.css" />
            <link rel="shortcut icon" href="../icon.png" />
            <link rel="apple-touch-icon-precomposed" href="../img/icon.png" />
            <link rel="stylesheet" href="../css/jquery-ui.css" />
            <style type="text/css">     
                @import url('../css/odontograma.css');
            </style>

            <script src="../js/jquery-1.9.1.js"></script>
            <script src="../js/jquery-ui.js"></script>            
            <script type="text/javascript" src="../js/odontograma.js"></script>
            <script src="../js/respond-min.js" type="text/javascript"></script>
            <script>
                $(function() {
                    $("#dialog").dialog({
                        autoOpen: false,
                        modal: true
                    });
                    $(".abrir")
                            .button()
                            .click(function() {
                                $.ajax({
                                    url: "odontogrmaDetalle.php?codigo=" + $(this).attr('codigo') + "&paciente=" + $(this).attr('paciente')
                                }).done(function(result) {
                                    $("#dialog #contenido").html(result);
                                });
                                $("#dialog").dialog("open");
                            });
                    $(".abrir2")
                            .button()
                            .click(function() {
                                $.ajax({
                                    url: "odontogrmaDetalleDialog.php?codigo=" + $(this).attr('codigo') + "&paciente=" + $(this).attr('paciente')
                                }).done(function(result) {
                                    $("#dialog #contenido").html(result);
                                });
                                $("#dialog").dialog("open");
                            });
                    $(".abrir3")
                            .button()
                            .click(function() {
                                $.ajax({
                                    url: "dialogoOdontograma.php?codigo=" + $(this).attr('codigo') + "&paciente=" + $(this).attr('paciente')
                                }).done(function(result) {
                                    $("#dialog #contenido").html(result);
                                });
                                $("#dialog").dialog("open");
                            });
                    $(".abrir4")
                            .button()
                            .click(function() {
                                $.ajax({
                                    url: "dialogoOdontogramafase4.php?codigo=" + $(this).attr('codigo') + "&paciente=" + $(this).attr('paciente')
                                }).done(function(result) {
                                    $("#dialog #contenido").html(result);
                                });
                                $("#dialog").dialog("open");
                            });
                });
            </script>
            <!--local fallback for JQuery-->

        </head>

        <!--===============================================================  Logo, social and menu =====================================================================================--> 
        <body>
            <div class="wrapper">   
                <a href="../index.php" id="logo"><img src="../img/logo.png" alt="something" />
                    <h1 class="accessibility"></h1></a>
                <div class="social">
                    <h2>
                        <?php echo $sesion->get("usuario"); ?> 
                    </h2>
                </div>


                <ul id="nav" class="main">
                    <li><a href="odontograma.php?idusuario=<?php echo $idPaciente; ?>" class="active">Odontograma</a></li>
                    <li><a href="principal.php" >Principal</a></li>
                    <li><a href="../system/cerrarsesion.php">salir</a></li>
                </ul>

            </div><!--end of wrapper div--> 

            <div class="clear"></div>    
            <!--===============================================================  Intro =====================================================================================--> 
            <div class="wrapper">
                <div class="grids">
                    <div style="text-align: center;">
                        <div id="contenido">
                            <div class="ui-separator ui-state-default ui-corner-all ui-widget-header">
                                <center>
                                    <table style="width: 90%;" >
                                        <tr>
                                            <td colspan="18">
                                                <strong>Convenciones</strong>
                                                <hr />
                                            </td >
                                        </tr>
                                        <tr>
                                            <?php
                                            $link = mysql_connect("localhost", "root", "");
                                            mysql_set_charset('utf8', $link);
                                            mysql_select_db("sirpof_db1", $link);
                                            //var_dump($idPaciente);
                                            $resultRol = mysql_query("SELECT descripcionitem,formula FROM lista WHERE id_grupo = 2 ", $link);
                                            $i = 0;
                                            while ($rowRol = mysql_fetch_row($resultRol)) {
                                                echo "
                                      <td><center><div style='width: 50px;  he border: 1; background-color: " . $rowRol[1] . "; margin-left: 10px; '>&nbsp; &nbsp; &nbsp;</div></center></td>
                                      \n";
                                                $i++;
                                            }
                                            ?>
                                        </tr>
                                        <tr>
                                            <?php
                                            $link = mysql_connect("localhost", "root", "");
                                            mysql_set_charset('utf8', $link);
                                            mysql_select_db("sirpof_db1", $link);
                                            //var_dump($idPaciente);
                                            $resultRol = mysql_query("SELECT descripcionitem,formula FROM lista WHERE id_grupo = 2", $link);
                                            $i = 0;
                                            while ($rowRol = mysql_fetch_row($resultRol)) {
                                                echo "
                                      <td><center>" . $rowRol[0] . "</center></td>
                                      \n";
                                                $i++;
                                            }
                                            ?>
                                        </tr>
                                    </table>
                                </center>
                            </div>
                            <br />
                            <center>
                                <!-- Contenido -->
                                <table style="width: 101%">
                                    <tr>
                                        <!-- Primer fragmento-->
                                        <td style="border:  1px;">
                                            <div id="zona1">
                                                <div id="zona1_content" class="ui-datagrid-content">
                                                    <table class="ui-datagrid-data">
                                                        <tr class="ui-datagrid-row">
                                                            <td class="ui-datagrid-column">

                                                                <form><center>
                                                                        <?php
                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente 
                                                                                                FROM odontograma o 
                                                                                                inner join lista l on o.id_diente = l.idlista
                                                                                                INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                                INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                                WHERE o.activo = 1 
                                                                                                AND id_diente = 1 
                                                                                                AND po.id_paciente = $idPaciente", $link);

                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div><img src='../img/dientes/18.png' /></div>"
                                                                            . "<p class='abrir' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "' >" . $row1[0] . "</p>"
                                                                            . "<div id='full'>";
                                                                            echo "
                                                                
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[4] . "'><input type='hidden' value='" . $row1[2] . "' name='c1'/></div>
                                                                    <div id='d' style='background-color: " . $row1[3] . "'><input type='hidden' value='" . $row1[3] . "' name='d1'/></div>
                                                                    <div id='e' style='background-color: " . $row1[2] . "'><input type='hidden' value='" . $row1[4] . "' name='e1'/></div>
                                                                    <div id='f' style='background-color: " . $row1[5] . "'><input type='hidden' value='" . $row1[5] . "' name='f1'/></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'><input type='hidden' value='" . $row1[6] . "' name='g1'/></div>
                                                                </div>  
                                                            </div><input type='hidden' value='" . $row1[7] . "' codigo2='" . $row1[7] . "' />
                                                             ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form>
                                                                    <center>
                                                                        <?php
                                                                        $resultHallazgo2 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o 
                                                                                        inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 2 
                                                                                        AND po.id_paciente = $idPaciente", $link);
                                                                        $i = 0;
                                                                        while ($row2 = mysql_fetch_row($resultHallazgo2)) {
                                                                            echo "<div><img src='../img/dientes/17.png' /></div>"
                                                                            . "<p class='abrir' codigo='" . $row2[1] . "' paciente='" . $row2[7] . "'>" . $row2[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row2[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row2[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row2[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row2[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row2[6] . "'></div>
                                                                </div>
                                                            </div><input type='hidden' value='" . $row2[0] . "' name='iddiente2'/>
                                                            ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?></center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form>
                                                                    <center>
                                                                        <?php
                                                                        $resultHallazgo2 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o 
                                                                                        inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 3 
                                                                                        AND po.id_paciente = $idPaciente", $link);
                                                                        $i = 0;
                                                                        while ($row2 = mysql_fetch_row($resultHallazgo2)) {
                                                                            echo "<div><img src='../img/dientes/16.png' /></div>"
                                                                            . "<p class='abrir' codigo='" . $row2[1] . "' paciente='" . $row2[7] . "'>" . $row2[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row2[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row2[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row2[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row2[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row2[6] . "'></div>
                                                                </div>
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente3'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form>
                                                                    <center>
                                                                        <?php
                                                                        $resultHallazgo2 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o 
                                                                                        inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 4 
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row2 = mysql_fetch_row($resultHallazgo2)) {
                                                                            echo "<div><img src='../img/dientes/15-55.png' /></div>"
                                                                            . "<p class='abrir' codigo='" . $row2[1] . "' paciente= '" . $row2[7] . "'>" . $row2[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row2[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row2[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row2[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row2[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row2[6] . "'></div>
                                                                </div>
                                                                
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente4'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form>
                                                                    <center>
                                                                        <?php
                                                                        $resultHallazgo2 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 5
                                                                                        AND po.id_paciente = $idPaciente", $link);
                                                                        $i = 0;
                                                                        while ($row2 = mysql_fetch_row($resultHallazgo2)) {
                                                                            echo "<div><img src='../img/dientes/14-54.png' /></div>"
                                                                            . "<p class='abrir' codigo='" . $row2[1] . "' paciente='" . $row2[7] . "'>" . $row2[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row2[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row2[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row2[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row2[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row2[6] . "'></div>
                                                                </div>
                                                                
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente4'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form>
                                                                    <center>
                                                                        <?php
                                                                        $resultHallazgo2 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 6 
                                                                                        AND po.id_paciente = $idPaciente", $link);
                                                                        $i = 0;
                                                                        while ($row2 = mysql_fetch_row($resultHallazgo2)) {
                                                                            echo "<div><img src='../img/dientes/13-53.png' /></div>"
                                                                            . "<p class='abrir' codigo='" . $row2[1] . "' paciente='" . $row2[7] . "'>" . $row2[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row2[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row2[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row2[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row2[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row2[6] . "'></div>
                                                                </div>
                                                                
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente5'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form>
                                                                    <center>
                                                                        <?php
                                                                        $resultHallazgo2 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 7 
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row2 = mysql_fetch_row($resultHallazgo2)) {
                                                                            echo "<div><img src='../img/dientes/12-52.png' /></div>"
                                                                            . "<p class='abrir' codigo='" . $row2[1] . "' paciente='" . $row2[7] . "'>" . $row2[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row2[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row2[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row2[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row2[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row2[6] . "'></div>
                                                                </div>
                                                                
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente6'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form>
                                                                    <center>
                                                                        <?php
                                                                        $resultHallazgo2 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 8 
                                                                                        AND po.id_paciente = $idPaciente", $link);
                                                                        $i = 0;
                                                                        while ($row2 = mysql_fetch_row($resultHallazgo2)) {
                                                                            echo "<div><img src='../img/dientes/11-51.png' /></div>"
                                                                            . "<p class='abrir' codigo='" . $row2[1] . "' paciente='" . $row2[7] . "'>" . $row2[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row2[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row2[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row2[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row2[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row2[6] . "'></div>
                                                                </div>
                                                                
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente7'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </div>
                                        </td>

                                        <!-- cierre del primer fragmento -->

                                        <!-- segundo fragmento-->


                                        <td>
                                            <div id="zona2" class="ui-datagrid ui-widget">
                                                <div id="zona2_content" class="ui-datagrid-content">
                                                    <table class="ui-datagrid-data" style="width: 101%">
                                                        <tr class="ui-datagrid-row">
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $resultHallazgo2 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 9 
                                                                                        AND po.id_paciente = $idPaciente", $link);
                                                                        $i = 0;
                                                                        while ($row2 = mysql_fetch_row($resultHallazgo2)) {
                                                                            echo "<div><img src='../img/dientes/21-61.png' /></div>"
                                                                            . "<p class='abrir2' codigo='" . $row2[1] . "' paciente='" . $row2[7] . "'>" . $row2[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                <div id='x'>
                                                                    <div id='d' style='background-color: " . $row2[4] . "'></div>
                                                                    <div id='c' style='background-color: " . $row2[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row2[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row2[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row2[6] . "'></div>
                                                                </div>
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente7'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 10 
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div><img src='../img/dientes/22-62.png' /></div>"
                                                                            . "<p class='abrir2' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                <div id='x'>
                                                                    <div id='d' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente7'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 11 
                                                                                        AND po.id_paciente = $idPaciente", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div><img src='../img/dientes/23-63.png' /></div>"
                                                                            . "<p class='abrir2' codigo='" . $row1[1] . "'  paciente='" . $row1[7] . "'>" . $row1[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                <div id='x'>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente7'/>  ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 12 
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div><img src='../img/dientes/24-64.png' /></div>"
                                                                            . "<p class='abrir2' codigo='" . $row1[1] . "'  paciente='" . $row1[7] . "'>" . $row1[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                <div id='x'>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente7'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 13 
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div><img src='../img/dientes/25-65.png' /></div>"
                                                                            . "<p class='abrir2' codigo='" . $row1[1] . "'  paciente='" . $row1[7] . "'>" . $row1[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                <div id='x'>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente7'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 14 
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div><img src='../img/dientes/26.png' /></div>"
                                                                            . "<p class='abrir2' codigo='" . $row1[1] . "'  paciente='" . $row1[7] . "'>" . $row1[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                <div id='x'>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente7'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 15 
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div><img src='../img/dientes/26.png' /></div>"
                                                                            . "<p class='abrir2' codigo='" . $row1[1] . "'  paciente='" . $row1[7] . "'>" . $row1[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                <div id='x'>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente7'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente = 16 
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div><img src='../img/dientes/28.png' /></div>"
                                                                            . "<p class='abrir2' codigo='" . $row1[1] . "'  paciente='" . $row1[7] . "'>" . $row1[0] . "</p>"
                                                                            . "<div id='full'>";

                                                                            echo "
                                                                <div id='x'>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                            </div>
                                                            <input type='hidden' value='" . $row2[0] . "' name='iddiente7'/> ";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </div>
                                        </td>

                                        <!-- cierre del tercer fragmento -->
                                    </tr>
                                </table>



                                <hr id="j_idt175" class="ui-separator ui-state-default ui-corner-all ui-widget-header" title="Distal" /><table>
                                    <tr>
                                        <td>

                                            <div style="width: 140px;"></div></td>
                                        <td>
                                            <div id="zona8" class="ui-datagrid ui-widget">
                                                <div id="zona8_content" class="ui-datagrid-content">

                                                </div>
                                            </div>
                                        </td>
                                        <td><div id="zona7" class="ui-datagrid ui-widget">
                                                <div id="zona7_content" class="ui-datagrid-content">

                                                </div>
                                            </div>
                                        </td>
                                        <td>
                                            <div style="width: 140px;"></div></td>
                                    </tr>
                                </table>
                                <table>
                                    <tr>
                                        <td>
                                            <div id="zona4" class="ui-datagrid ui-widget">
                                                <div id="zona4_content" class="ui-datagrid-content">
                                                    <table class="ui-datagrid-data" style="width: 101%">
                                                        <tr class="ui-datagrid-row">
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  17
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir3' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/48.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  18
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir3' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/47.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>

                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  19
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir3' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/46.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  20
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir3' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/45-85.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  21
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir3' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/44-84.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  22
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir3' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/43-83.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  23
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir3' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/42-82.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  24
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir3' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/41-81.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </div>
                                        </td>
                                        <td>
                                            <div id="zona3" class="ui-datagrid ui-widget">
                                                <div id="zona3_content" class="ui-datagrid-content">
                                                    <table class="ui-datagrid-data" style="width: 101%">
                                                        <tr class="ui-datagrid-row">
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  25
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir4' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/31-71.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  26
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir4' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/32-72.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  27
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir4' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/33-73.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  28
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir4' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/34-74.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  29
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir4' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/35-75.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  30
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir4' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/36.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  31
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir4' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/37.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                            <td class="ui-datagrid-column">
                                                                <form method="POST" action="odontogrmaDetalle.php">
                                                                    <center>
                                                                        <?php
                                                                        $link = mysql_connect("localhost", "root", "");
                                                                        mysql_select_db("sirpof_db1", $link);

                                                                        $resultHallazgo1 = mysql_query("SELECT l.descripcionitem, l.idlista, lis_idhallazgo2, lis_idhallazgo3, lis_idhallazgo4, lis_idhallazgo5, lis_idhallazgo6, po.id_paciente
                                                                                        FROM odontograma o inner join lista l on o.id_diente = l.idlista
                                                                                        INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro
                                                                                        INNER JOIN paciente p on p.id_paciente = po.id_paciente
                                                                                        WHERE o.activo = 1 
                                                                                        AND id_diente =  32
                                                                                        AND po.id_paciente = $idPaciente ", $link);
                                                                        $i = 0;
                                                                        while ($row1 = mysql_fetch_row($resultHallazgo1)) {
                                                                            echo "<div id='full'>
                                                                <div id='x'>
                                                                    <div id='c' style='background-color: " . $row1[3] . "'></div>
                                                                    <div id='d' style='background-color: " . $row1[4] . "'></div>
                                                                    <div id='e' style='background-color: " . $row1[5] . "'></div>
                                                                    <div id='f' style='background-color: " . $row1[2] . "'></div>
                                                                    <div id='g' style='background-color: " . $row1[6] . "'></div>
                                                                </div>
                                                                <br />
                                                            </div><p class='abrir4' codigo='" . $row1[1] . "' paciente='" . $row1[7] . "'>" . $row1[0] . "</p>";
                                                                            echo "<div><img src='../img/dientes/38.png' /></div>";

                                                                            echo "  </div>\n";
                                                                            ?>
                                                                            <?php
                                                                        }
                                                                        ?>
                                                                    </center>
                                                                </form>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </div>
                                            </div>
                                        </td>
                                    </tr>
                                </table>
                                <hr />
                                <form method="post" action="guardarDxOdontograma.php">
                                    <table style="width: 80%; text-align: center;">
                                        <thead>
                                            <tr>
                                                <th>
                                        <h2>
                                            Diagnóstico Maxilar Superior.</h2>
                                        </th>
                                        <th>
                                        <h2>
                                            Diagnóstico Maxilar Inferior.</h2>
                                        </th>
                                        </tr>
                                        </thead>
                                        <tfoot>
                                            <tr>
                                                <td>
                                                    &nbsp;
                                                </td>
                                            </tr>
                                        </tfoot>
                                        <tbody>
                                            <?php
                                            $result = "SELECT DISTINCT po.id_registro FROM odontograma o inner join lista l on o.id_diente = l.idlista INNER JOIN paciente_odontograma po on po.id_registro = o.id_registro INNER JOIN paciente p on p.id_paciente = po.id_paciente WHERE o.activo = 1 AND po.id_paciente = " . $idPaciente;
                                            $resultQuery = mysql_query($result, $link);
                                            $row1 = mysql_fetch_row($resultQuery);
                                            $idregistro = $row1[0];

                                            $sqlDx = "SELECT * FROM diagnostico_odontograma WHERE id_registro = " . $idregistro . " AND tipo = 'dxMaxSup'";
                                            $sqlDx = mysql_query($sqlDx, $link);
                                            $row = mysql_fetch_row($sqlDx);

                                            $sqlDxInf = "SELECT * FROM diagnostico_odontograma WHERE id_registro = " . $idregistro . " AND tipo = 'dxMaxInf'";
                                            $sqlDxInf = mysql_query($sqlDxInf, $link);
                                            $rowInf = mysql_fetch_row($sqlDxInf);
                                            ?>
                                            <tr>
                                                <td>
                                                    <table style="width: 80%;">
                                                        <tr>
                                                            <td>
                                                                Ortodoncia
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $Ortodoncia1 = $row[2];
                                                                if ($Ortodoncia1 == false) {
                                                                    $itemOrtodoncia1 = "";
                                                                } else {
                                                                    $itemOrtodoncia1 = "checked";
                                                                }
                                                                ?>
                                                                <input type="checkbox" name="Ortodoncia1" <?php echo $itemOrtodoncia1; ?>>Remobible</input> 
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $fija = $row[3];
                                                                if ($fija == false) {
                                                                    $itemfija = "";
                                                                } else {
                                                                    $itemfija = "checked";
                                                                }
                                                                ?>
                                                                <input type="checkbox" name="fija" <?php echo $itemfija; ?> >Fija</input>
                                                            </td>
                                                        </tr>
                                                    </table>


                                                </td>
                                                <td>
                                                    <table style="width: 80%;">
                                                        <tr>
                                                            <td>
                                                                Ortodoncia
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $OrtodonciaInf = $rowInf[2];
                                                                if ($OrtodonciaInf == false) {
                                                                    $itemOrtodonciainf = "";
                                                                } else {
                                                                    $itemOrtodonciainf = "checked";
                                                                }
                                                                ?>
                                                                <input type="checkbox" <?php echo $itemOrtodonciainf; ?> name="Ortodoncia2" >Remobible</input> 
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $OrtodonciaInffija = $rowInf[3];
                                                                if ($OrtodonciaInffija == false) {
                                                                    $itemOrtodonciainfija = "";
                                                                } else {
                                                                    $itemOrtodonciainfija = "checked";
                                                                }
                                                                ?>
                                                                <input type="checkbox" <?php echo $itemOrtodonciainfija; ?> name="fija" >Fija</input></td>
                                                            </td>
                                                        </tr>
                                                    </table>


                                            </tr>
                                            <tr>
                                                <td>
                                                    <table style="width: 80%;">
                                                        <tr>
                                                            <td>
                                                                Protesis
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $Protesissup = $row[4];
                                                                if ($Protesissup == false) {
                                                                    $itemProtesissup = "";
                                                                } else {
                                                                    $itemProtesissup = "checked";
                                                                }
                                                                ?>
                                                                <input type="checkbox" <?php echo $itemProtesissup; ?> name="Protesis1" >Removible</input> 
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $Protesissup1 = $row[5];
                                                                if ($Protesissup1 == false) {
                                                                    $itemProtesissup1 = "";
                                                                } else {
                                                                    $itemProtesissup1 = "checked";
                                                                }
                                                                ?>
                                                                <input type="checkbox" name="fija" <?php echo $itemProtesissup1; ?>  >Fija</input></td>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                <td>
                                                    <table style="width: 80%;">
                                                        <tr>
                                                            <td>
                                                                Protesis
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $Protesisinf2 = $rowInf[4];
                                                                if ($Protesisinf2 == false) {
                                                                    $itemOrtodonciainf2 = "";
                                                                } else {
                                                                    $itemOrtodonciainf2 = "checked";
                                                                }
                                                                ?>
                                                                <input type="checkbox" <?php echo $itemOrtodonciainf2; ?> name="Protesis2" >Removible</input> 
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $Protesisinf3 = $rowInf[5];
                                                                if ($Protesisinf3 == false) {
                                                                    $itemProtesisinf3 = "";
                                                                } else {
                                                                    $itemProtesisinf3 = "checked";
                                                                }
                                                                ?>
                                                                <input type="checkbox" name="fija" <?php echo $itemProtesisinf3; ?>>Fija</input></td>
                                                            </td>
                                                        </tr>
                                                    </table>

                                            </tr>
                                            <tr>
                                                <td>
                                                    <table style="width: 80%;">
                                                        <tr>
                                                            <td>
                                                                Forma de arco
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $item = $row[6];
                                                                if ($item == false) {
                                                                    $itemsel = "Seleccione";
                                                                } else {
                                                                    $itemsel = $item;
                                                                }
                                                                ?>
                                                                <select name="farco1" class="input" required> 
                                                                    <option value="<?php echo $itemsel; ?>"><?php echo $itemsel; ?></option>
                                                                    <option value="ovoide">ovoide</option>
                                                                    <option value="Triangular">Triangular</option>
                                                                    <option value="Cuadrado">Cuadrado</option>
                                                                </select>
                                                            </td>
                                                        </tr>
                                                    </table>


                                                </td>
                                                <td>
                                                    <table style="width: 80%;">
                                                        <tr>
                                                            <td>
                                                                Forma de arco
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $itemFor = $rowInf[6];
                                                                if ($itemFor == false) {
                                                                    $itemFortemsel = "Seleccione";
                                                                } else {
                                                                    $itemFortemsel = $itemFor;
                                                                }
                                                                ?>
                                                                <select name="farco2" class="input" required> 
                                                                    <option value="<?php echo $itemFortemsel; ?>"><?php echo $itemFortemsel; ?></option>
                                                                    <option value="ovoide">ovoide</option>
                                                                    <option value="Triangular">Triangular</option>
                                                                    <option value="Cuadrado">Cuadrado</option>
                                                                </select>
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <table style="width: 80%;">
                                                        <tr>
                                                            <td>
                                                                Labio
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $itemL = $row[7];
                                                                if ($itemL == false) {
                                                                    $itemselL = "Seleccione";
                                                                } else {
                                                                    $itemselL = $itemL;
                                                                }
                                                                ?>
                                                                <select name="labio1" class="input" required> 
                                                                    <option value="<?php echo $itemselL; ?>"><?php echo $itemselL; ?></option>
                                                                    <option value="Grueso">Grueso</option>
                                                                    <option value="Medio">Medio</option>
                                                                    <option value="Delgado">Delgado</option>
                                                                </select>
                                                            </td>
                                                        </tr>
                                                    </table>


                                                </td>
                                                <td>
                                                    <table style="width: 80%;">
                                                        <tr>
                                                            <td>
                                                                Labio
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $itemForLab = $rowInf[7];
                                                                if ($itemForLab == false) {
                                                                    $itemForLabsel = "Seleccione";
                                                                } else {
                                                                    $itemForLabsel = $itemForLab;
                                                                }
                                                                ?>
                                                                <select name="labio2" class="input" required> 
                                                                    <option value="<?php echo $itemForLabsel; ?>"><?php echo $itemForLabsel; ?></option>
                                                                    <option value="Grueso">Grueso</option>
                                                                    <option value="Medio">Medio</option>
                                                                    <option value="Delgado">Delgado</option>
                                                                </select>
                                                            </td>
                                                        </tr>
                                                    </table>


                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <table style="width: 90%;">
                                                        <tr>
                                                            <td>
                                                                <span style="text-align: left;">
                                                                    Exostosis/Torus 
                                                                </span>
                                                            </td>
                                                            <td>
                                                                <?php
                                                                $et1 = $row[8];
                                                                if ($et1 == false) {
                                                                    $itemet = " ";
                                                                } else {
                                                                    $itemet = "checked";
                                                                }
                                                                ?>
                                                                <input type="checkbox" <?php echo $itemet; ?> name="et1" >si</input>
                                                            </td>
                                                        </tr>
                                                    </table>  
                                                </td>
                                                <td>
                                                    <table style="width: 80%;">
                                                        <tr>
                                                            <td>
                                                                Exostosis/Torus
                                                            </td>
                                                            <td>
                                                                <?php
                                                                ?>
                                                                <input type="checkbox" name="et2" >si</input> 
                                                            </td>
                                                        </tr>
                                                    </table>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <br />
                                                    <strong>Señales Particulares (Tauajes, Cicatrices, Amputaciones, entre otros.)</strong>
                                                    <br /> 
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <textarea name="txtSeñales" style="width: 90%;" required><?php echo $row[0] ?></textarea>
                                                    <input type="hidden" name="idpaciente" value="
                                                    <?php echo $idPaciente; ?>
                                                           " id="idpaciente" />
                                                </td>
                                            </tr>
                                            <tr>
                                                <td colspan="2">
                                                    <input type="submit" name="btnGuardar" id="btnGuardar" value="Guardar" class="button" />
                                                </td>
                                            </tr>
                                        </tbody>
                                    </table>
                                </form>
                            </center>

                            <div id="dialog" title="Datos Basicos">
                                <div id="contenido">
                                    CARGANDO....
                                </div>
                                <!-- Fin Contenido -->
                            </div>

                        </div>

                        <a id="scroll-up" style="display: none;" onclick="scrollTo(0, 0)"></a>

                    </div><!--end of div grids-->

                </div><!--end of div wrapper-->    

                <!--===============================================================  Footer =====================================================================================-->  
                <div class="wrapper">
                    <div id="footer">


                        <div class="grids">
                            <center>
                                <p>ForensicTooth v 1.0</p>
                            </center>

                        </div><!--end of grids-->
                    </div><!--end of footer-->
                </div><!--end of wrapper-->



        </body>
    </html>

    <?php
}
?>
